package com.intct.hbase.dml.impl;

import com.intct.hbase.dml.AbsDMLSerivce;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Table;

import java.io.IOException;

/**
 * @author gufg
 * @since 2025-09-29 15:22
 */
public class PutData extends AbsDMLSerivce {
    @Override
    public void execCommand(Table table) {
        // 插入 put '命名空间名称:表名','rowkey','列族:列','值'
        Put put = new Put("1001".getBytes());
        put.addColumn("f1".getBytes(), "id".getBytes(), "USER_1003".getBytes());
        put.addColumn("f1".getBytes(), "name".getBytes(), "zhaolu".getBytes());
        put.addColumn("f1".getBytes(), "age".getBytes(), "19".getBytes());
        put.addColumn("f2".getBytes(), "id".getBytes(), "F2_USER_1001".getBytes());
        try {
            table.put(put);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) throws IOException {
        new PutData().start("intct85", "t3");
    }
}
